1. Field of the Invention
The present invention relates to a computer implemented compiling tool, and more particularly a computer implemented method and apparatus for optimizing compiler generated object code.
2. Background Information
Most computer programmers write computer programs in source code using high-level languages such as C, FORTRAN, or PASCAL. While programmers may easily understand such languages, modern computers are not able to directly read and execute such languages. Thus, such computer programs must be translated into a language, known as machine language, that a specific computer can read and execute. One step in the translating process is performed by a compiler. A compiler can be thought of as a collection of interfacing algorithms, that together typically and generally translate a high-level source code program into an object code program (where it is understood that the term as used in this specification refers to any mechanism that transforms the representation of a program into another representation). The object code for execution by a computer is machine language.
A compiler generally has a front end that transforms the source code into a low level, yet largely machine independent language, called the intermediate code; and a back end that converts the intermediate code into the machine specific object code. Object code produced by conventional compilers may often be made to improve their performance in some characteristic, such as by executing faster, by minimizing bus utilization, or by requiring less memory. This improvement is called optimization. Compilers that apply code-improving transformations are called optimizing compilers.
A conventional optimizing compiler takes as input the intermediate code output by a compiler front end, and applies some static heurism to the intermediate code to hopefully produce an object code version that is more efficient than the object code would be without the transformations, without changing the meaning of the source program. These static optimization techniques include common subexpression elimination, instruction re-ordering, dummy instruction insertion, instruction substitution, loop unrolling, and loop fusion.
The problem is that prior art optimizing compilers apply only static, generic, and generally global change(s) to the code because they do not optimize for specific code variable values, and because they do not evaluate the affect of individual code changes on the performance of the object code.